package com.outstanding.junit.dto.voice;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.outstanding.framework.core.MultiPendingException;
import com.outstanding.framework.core.RequestDTO;



@SuppressWarnings("rawtypes")
public class VoiceReqDto extends RequestDTO {
	
	public VoiceReqDto() {
		
	}
	public VoiceReqDto(String code,String mobile) {
		this.code = code;
		this.mobile = mobile;
	}
	/** serialVersionUID */
	private static final long serialVersionUID = -5703938849350099614L;

	/** 验证码 */
	private String code;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	/** 手机号码 */
	private String mobile;

	@Override
	public boolean validate() throws MultiPendingException {

		if (StringUtils.isEmpty(code) || !code.matches("^[0-9]{6}$")) {
			return false;
		}

		if (StringUtils.isEmpty(mobile)) {
			return false;
		}

		return true;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
}
